package org.javaboy.sentinel.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class HelloController {

    @GetMapping("/hello")
    @SentinelResource(value = "hello", fallback = "helloFallback")
    public String hello(String name) throws InterruptedException {
        Thread.sleep(3000);
        System.out.println(new Date());
        return "hello";
    }

    public String helloFallback(String name) {
        return "hello fallback";
    }
}
